﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace MLY
{
  public partial class ErrorPage : Bll.BasePage
  {
    protected void Page_Load(object sender, EventArgs e)
    {
        //string ExceptionMessage = "";
        //string ErrorPath = "";
        //string user = "";
        //string errMsg = "";
        //string stacktrace = "";
        //Exception currExp = (Exception)Application["currError"];

        //if (Request.QueryString["aspxerrorpath"] != null)
        //{
        //    ErrorPath = Request.QueryString["aspxerrorpath"];
        //}
        //if (ErrorPath != "/LTR/undefined")
        //{
        //    if (currExp != null)
        //    {
        //        ExceptionMessage = currExp.Message;
        //        stacktrace = currExp.StackTrace;
        //    }

        //    if (Session["FullName"] != null)
        //    {
        //        user = Session["FullName"].ToString();
        //    }

        //    errMsg = "<u>Error caught in  MLY system.</u><br/> StackTrace: " + stacktrace +
        //             "<br/> Message: " + ExceptionMessage +
        //             "<br/> " + "Url: " + ErrorPath +
        //             "<br/> " + "User: " + user;
        //    //      Application.Remove("currError");
        //    //      //if (sendMailToAdmin)
        //    //      //{
        //    //        string errMsg = String.Format(@"Error Caught in Application_Error MLY : <br/>  <br/> StackTrace:{0}  <br/>  <br/>  Message:{1}  <br/>  <br/> 
        //    //                 Url:{2}  <br/>  <br/> ", stackTrace, Message, offendingUrl);
        //    //        Utils.mlySendMail("Error Handeled at MLY", "pastch@gmail.com", "", "", errMsg, false, null);
        //    //      //}
        //    Utils.mlySendMail("Error Handeled at MLY", "pastch@gmail.com", "", "", errMsg, false, null);
        //}
    }

    //public bool sendMailToAdmin
    //{
    //  get
    //  {
    //    bool t;
    //    return
    //        ConfigurationManager.AppSettings["sendErrorsToAdmin"] == null ?
    //         false :
    //         bool.TryParse(ConfigurationManager.AppSettings["sendErrorsToAdmin"].ToString(), out t) == true ?
    //        bool.Parse(ConfigurationManager.AppSettings["sendErrorsToAdmin"].ToString()) : false;
    //  }
    //}
    //public string stackTrace { get { return currExp != null ? currExp.StackTrace : ""; } }
    //public string Message { get { return currExp != null ? currExp.Message : ""; } }
    //public string Source { get { return currExp != null ? currExp.Source : ""; } }
    //public string offendingUrl { get { return currExp != null ? currExp.Data["OffendingUrl"].ToString() : "unknown error"; } }

    //protected override void OnError(EventArgs e)
    //{

    //}z

  }
}
